package nc.impl.byb.service;

import java.util.HashMap;

import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.itf.byb.service.IPuchaseInService;
import nc.itf.uap.pf.IplatFormEntry;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.ic.pub.pf.ICPFParameter;
import nc.vo.pub.BusinessException;

public class PurchaseInServiceImpl implements IPuchaseInService {

	@Override
	public void saveAndSign(PurchaseInVO aggvo) throws BusinessException {
		HashMap<String,String> eParam = new HashMap<String,String> ();
		eParam.put("notechecked", "notechecked");
		
		InvocationInfoProxy.getInstance().setGroupId(aggvo.getParentVO().getPk_group());
		
		try {
			IplatFormEntry iIplatFormEntry = (IplatFormEntry)NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
			Object retObj = iIplatFormEntry.processAction("WRITE"+aggvo.getParentVO().getCreator(), "45", null, aggvo, new ICPFParameter(), eParam);
			iIplatFormEntry.processAction("SIGN"+aggvo.getParentVO().getCreator(), "45", null, ((PurchaseInVO[])retObj)[0], null, eParam);
		} catch (Exception e) {
			Logger.error(e.getMessage(),e);
			throw new BusinessException(e.getMessage(),e);
		}
	}

}
